/*
 * Títutlo: LogController.java
 * Autor: Oswaldo Ceballos Zavala (Inu)
 * Descripción: Clase Controller de Log
 * 
 * Universidad Autónoma de Yucatán
 * 
 */
package aerodromo.controller;

import aerodromo.model.Aerodromo;
import aerodromo.model.Operacion;
import aerodromo.util.estructurasDatos.lista.ListNode;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author Oswaldo.C
 */
public class LogController {
    
    
    public String getBitacora(){
        
        String bitacora = "ACCION      MATRICULA      COMB.      PASAJEROS";
        bitacora += "\n";
        bitacora += "------------------------------------------------------------------------";
        
        ListNode<Operacion> current = Aerodromo.getAerodromo().getLog().getFirstNode();
        
        while ( current != null ){
            bitacora += current.getData().toString();
            bitacora += "\n";
            
            current = current.getSiguiente();
        }
        
        
        return bitacora;
    }
    
    public void saveLog( String log ) throws FileNotFoundException, IOException{
        Aerodromo.getAerodromo().guardar(log);
    }
    
    
}
